<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script src="./js/03-ajax.js"></script>
  <script>
    // 如果一个类中包含一个then方法，它会包装成一个promise

    class User{
      async get(name) {
        let user = await ajax(`http://localhost:3000/profile?${name}`)
        user.name += '&json'
        return user
      }
    }
    // async function get() {
    //   let user = await new User('lisa');
    //   console.log(user)
    // }
    new User().get('lisa').then(value => {
      console.log(value)
    })
  </script>
</body>
</html>